<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        /* 
            keys()返回的是一个数组的迭代对象，索引值
            values() 返回的是一个数组的迭代对象，元素值
            entries:返回的是一个数组的迭代对象,该对象中包含数组的键值对(index/value)
        
       */
        var set=new Set(["alice","cc","lili","baby"]);
        set.add("lucy");
        console.log(set);
        // set.forEach(function(value,index){
        //     console.log(value+"="+index);//set集合中元素的值
        // });

        // for(var  i of set){
        //     console.log(i);
        // }
    //    var arrs=[10,29,30,4];
    //    var it=arrs.keys();
    //    console.log(it);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next());
    //    console.log(it.next());
    //    console.log(it.next());
    //    console.log(it.next());
    //    console.log(it.next());

    
       var arrs=[10,29,30,4];
      /*  var it=arrs.keys();
       var next=it.next();
       while(!next.done){
            console.log(next.value);//0 1  2  3
            next=it.next();//
       } */

    //    var it=arrs.values();
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //     var it=arrs.values();
    //     var next=it.next();
    //     while(!next.done){
    //         console.log(next.value);//
    //         next=it.next();//
    //    } 

    //    var it=arrs.entries();
    //    console.log(it);
    //    console.log(it.next().value[1]);

       var set=new Set(["aa","bb","cc","dd"]);
    //    var it=set.keys();
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    var it=set.values();
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);
    //    console.log(it.next().value);

    var it=set.entries();
    console.log(it);
    console.log(it.next().value);
    console.log(it.next().value);
    console.log(it.next().value);
    console.log(it.next().value);
    console.log(it.next().value);

    </script>
</head>
<body>
    
</body>
</html>